<?php


namespace app\admin\validate\member;


use think\Validate;

class MemberKey extends validate
{

    protected $rule =   [
        'user_id'  => ['require',   'unique'=>'member_key'],
        'app_id'=>['require','length'=>'6,16'],
        'app_key'=>['require'],
        'app_secret'=>['require'],
    ];
    protected $message  =   [
        'user_id.require'      => ['code' => 4012, 'msg' => '会员id不能为空'],
        'user_id.unique'       => ['code' => 4013, 'msg' => '会员id已经存在'],
        'app_id.require'       => ['code' => 4015, 'msg' => 'app_id 必填'],
        'app_id.length'        => ['code' => 4015, 'msg' => '长度是6-16位'],
        'app_key.require'      => ['code' => 4015, 'msg' => '私钥钥必填'],
        'app_secret.require'   => ['code' => 4015, 'msg' => '公钥必填'],
    ];

    // edit 验证场景定义
    public function sceneModify()
    {
        return $this->remove('user_id',true);
    }
}